# import numpy as np
# from scipy.ndimage import rotate
# import matplotlib.pyplot as plt
#
# # 假设你的多波段数据是通过 np.load 加载的
# def load_multiband_data(file_path):
#     return np.load(file_path)  # 读取 npy 文件
#
# # 对多波段影像进行旋转
# def rotate_multiband_image(bands, angle):
#     rotated_bands = []
#     for band in bands:
#         # 使用 scipy.ndimage.rotate 进行图像旋转
#         rotated_band = rotate(band, angle, reshape=True, mode='nearest', order=1)
#         rotated_bands.append(rotated_band)
#     return np.array(rotated_bands)
#
# # 显示某个波段图像
# def display_band_image(band):
#     plt.imshow(band, cmap='gray')
#     plt.colorbar()
#     plt.title("Rotated Band")
#     plt.show()
#
# # 主程序
# def main():
#     # 加载多波段影像数据
#     input_file = 'data/image/28.npy'  # 输入数据文件路径
#     bands = load_multiband_data(input_file)
#
#     # 设置旋转角度
#     angle = 135  # 旋转角度（可以根据需求修改）
#
#     # 进行旋转处理
#     rotated_bands = rotate_multiband_image(bands, angle)
#
#     # 可选：显示旋转后的某个波段图像
#     display_band_image(rotated_bands[0])  # 显示第一个波段（可根据需求选择波段）
#
# if __name__ == "__main__":
#     main()
import os

from matplotlib import pyplot as plt

from rs_trasformer import Compose,RandomRotate
name='28.npy'# md随便选了几张结果连分割图都没有，倒霉
x1=r'data\image'
x2=r'data\edge'
x3=r'data\mask'
input=os.path.join(x1,name)#4波段数据
edge=os.path.join(x2,name) #边缘线分割图
mask=os.path.join(x3,name) #地块分割图

transformers=Compose([
        RandomRotate(prob=0.5, ig_pix=255)
     ] #填充的颜色
)
x=transformers(input,edge,mask)


plt.imshow(x[1], cmap='gray')  # 显示第一个图像
plt.colorbar()  # 显示颜色条
plt.show()
plt.imshow(x[2], cmap='gray')  # 显示第一个图像
plt.colorbar()  # 显示颜色条
plt.show()